package com.winit.requirement.eventListener;

import com.winit.common.CloudLinkSend.MqMessage;
import com.winit.common.CloudLinkSend.MqMsgType;
import com.winit.common.CloudLinkSend.MsgSend;
import com.winit.common.base.bean.Status;
import com.winit.common.util.Constants;
import com.winit.issue.manager.IssueManager;
import com.winit.projectPlan.manager.ProjectPlanMananger;
import com.winit.projectPlan.repository.ProjectPlanRepository;
import com.winit.requirement.manager.BrdRequirementManager;
import com.winit.requirement.model.BrdRequirement;
import com.winit.requirement.repository.BrdRequirementRepository;
import com.winit.requirement.service.BrdRequirementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wanglin on 2018/6/1.
 */
@Component
@RabbitListener(queues = "req-receive-status-queue")
public class ReqListener {
    private static Logger logger = LoggerFactory.getLogger(com.winit.issue.eventListener.IssueListener.class);

    @Autowired
    ProjectPlanMananger projectPlanMananger;


    @Autowired
    MsgSend msgSend;

    @RabbitHandler
    public void process(MqMessage message) {
        Map map = message.getMap();
        MqMsgType type = message.getType();
        logger.info(map.toString());
        switch (type){
            case ONLINE:
                projectPlanMananger.dealUPlanOnline((String) map.get("plan_id"));
                break;
        }
    }


}
